<?php

namespace App\Http\Controllers\Web;

use App\SysConfig;
use Illuminate\Http\Request;

class SetController extends Controller
{
    public function  index(Request $request) {
        if($request->isMethod('get')) {
            $data = SysConfig::pluck('value','key');
            return view('web.set.index',$data);
        } else {
            $item = SysConfig::where('key','phone')->first();
            $item->value = $request->input('phone');
            $item->save();

            return redirect()->route('admin.set')->with('msg','操作成功！');
        }
    }
}
